<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Registration</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">
		<script src="../js/sha256.js"></script>
		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<script src="../js/jsUgrRegister.jQuery.js"></script>
		<script src="../addons/bootstrap/js/bootstrap.js"></script>

		<!-- Le styles -->
		<link href="../addons/bootstrap/css/bootstrap.css" rel="stylesheet">
		<link href="../css/forms.css" rel="stylesheet">

		<link href="../addons/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

		<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
		<!--[if lt IE 9]>
		<script src="../assets/js/html5shiv.js"></script>
		<![endif]-->

	</head>

	<body>

		<div class="container">

			<form id="formulario" class="form-signin" action="confirmation.html" method="get">
				<h2 class="form-signin-heading">Registration</h2>
				<div class="jsUgr user">
					<input class="input-block-level" placeholder="Username" name="user" size="10" type="text" title="user" value="" >
					<img class="jsUgrCheck" src="../image/green_check.png" title="ayuda" height="20" width="20" style="display: none">
					<span class="jsUgrError"> </span>
				</div>
				<div class="jsUgr email">
					<input  class="input-block-level" placeholder="Email address" name="email" size="10" type="text" title="email" value="" >
					<img class="jsUgrCheck" src="../image/green_check.png" title="ayuda" height="20" width="20" style="display: none">
					<span class="jsUgrError"> </span>
				</div>
				<div class="jsUgr pass">
					<input  class="input-block-level" placeholder="Password" name="pass" size="10" type="password" title="password" value="" >
					<img class="jsUgrCheck" src="../image/green_check.png" title="ayuda" height="20" width="20" style="display: none">
					<span class="jsUgrError"> </span>
				</div>
				<div class="jsUgr pass2">
					<input class="input-block-level" placeholder="Repeat password" name="pass2" size="10" type="password" title="password confirmation" value="" >
					<img class="jsUgrCheck" src="../image/green_check.png" title="ayuda" height="20" width="20" style="display: none">
					<span class="jsUgrError"> </span>
				</div>
				<input type="submit" id="submit" style="display: none">
				<div id="button-submit">
					<button type="button" class="btn btn-large btn-primary" id="jsUgrSend" disabled="disabled">
						Send
					</button>
					<span id='jsUgrError'> </span>
				</div>
			</form>

			<script type="text/javascript">
				$("document").ready(function() {
					function checkEnter(e){
						e = e || event;
						var txtArea = /textarea/i.test((e.target || e.srcElement).tagName);
						return txtArea || (e.keyCode || e.which || e.charCode || 0) !== 13;
					}
					document.querySelector('form').onkeypress = checkEnter;
					var elem = window.parent.document.getElementById('iframe-registro');
					if (elem)
						elem.style.height = '400px';
					$('#formulario').jsUgrValidator("nothing", function(data) {
						$('.input-block-level').keypress(function(e) {
						    if(e.which == 13) {
						       //$('#jsUgrSend').trigger('click');
						    }
						});
					});
					$("#jsUgrSend").jsUgrRegister('register', function(data) {
						if (data.ok) {
							$('#submit').trigger('click');
						} else {
							$("#jsUgrError").html(data.error + ". " + data.reason);
						}
					});
				});

			</script>
		</div>
	</body>
</html>
